//	--------------------------------------------------------------------
//	Copyright(C) 2006,2007 Zhao Yukun. All rights reserved.
//	This file is a part of the Xeres system.
//	Xeres 2007
//	Contact : xeres.engine@gmail.com
//	$(reservedInfo)
//	$(reservedDeclaration)
//	--------------------------------------------------------------------
///	@file	<CCanvasSlot.cpp>
///	@path	~/src/graphics/canvas/
///	@date	2008/04/23
///	@desc	.

#include "config/config.h"

#include "graphics/canvas/CCanvasSlot.h"

namespace xeres {

	IMPL_IOBJECT_CLASS( CCanvasSlot );

	// CCanvasSlot
	CCanvasSlot::CCanvasSlot( size_t slot_count )
	{
		m_subCanvas.resize( slot_count );
	}
	// ~CCanvasSlot
	CCanvasSlot::~CCanvasSlot( void )
	{

	}
	// Initialize
	void CCanvasSlot::Initialize( RefWeak<IRenderer> renderer )
	{
	}
	// Finalize
	void CCanvasSlot::Finalize( void )
	{
		m_subCanvas.clear();
	}
	// Render
	void CCanvasSlot::Render( RenderContext& rc )
	{
		for( size_t i = 0 , total = m_subCanvas.size() ; i < total ; ++i )
		{
			if( m_subCanvas[i].IsValid() )
				m_subCanvas[i]->Render( rc );
		}
	}
	// SetSlot
	void CCanvasSlot::SetSlot( size_t slot , RefWeak<ICanvas> sub_canvas )
	{
		assert( slot < m_subCanvas.size() );
		m_subCanvas[slot] = sub_canvas;
	}

} // namespace xeres
